<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
    <title>Document</title>
  </head>
  <body>
    <script>
      // 反转数组
      var arr = ['red', 'green', 'blue'];
      arr.reverse();
      console.log(arr);	   // 输出结果：(3) ["blue", "green", "red"]
      // 数组排序
      var arr1 = [13, 4, 77, 1, 7];
      arr1.sort(function (a, b) {
        return b - a;	   	// 降序的顺序排列
      });
      console.log(arr1);	// 输出结果：(5) [77, 13, 7, 4, 1]
    </script>
  </body>
</html>